package gui.newgui.informationpanel;

import gui.newgui.IArCompGuiComponent;
import gui.newgui.IController;

import javax.swing.BorderFactory;
import javax.swing.GroupLayout;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;

import core.CustomIcons;

public class InformationPanel extends javax.swing.JPanel implements IArCompGuiComponent {
	private final IController controller;
	private JComboBox tournamentTypeDropDown;
	private JTextField refereeTextField;
	private JLabel logoLabel;
	private JPanel statisticsWrapper;
	private JTextField tournamentLeadTextField;
	private JTextField organizerTextField;
	private JTextField endDateTextField;
	private JLabel separatorLabel;
	private JTextField startDateTextField;
	private JTextField tournamentNameTextField;

	public InformationPanel() {
		super();
		this.controller = new InformationPanelController(this);
		this.initGUI();
		((InformationPanelController) this.controller).setDropDown();
	}

	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout(this);
			this.setLayout(thisLayout);
			this.setPreferredSize(new java.awt.Dimension(393, 539));
			{
				this.tournamentTypeDropDown = new JComboBox();
			}
			{
				this.tournamentNameTextField = new JTextField();
			}
			{
				this.startDateTextField = new JTextField();
			}
			{
				this.separatorLabel = new JLabel();
				this.separatorLabel.setText("   -");
			}
			{
				this.endDateTextField = new JTextField();
			}
			{
				this.organizerTextField = new JTextField();
			}
			{
				this.tournamentLeadTextField = new JTextField();
			}
			{
				this.refereeTextField = new JTextField();
			}
			{
				this.statisticsWrapper = new JPanel();
				this.statisticsWrapper.setBorder(BorderFactory.createTitledBorder("Statistiken"));
			}
			{
				this.logoLabel = new JLabel();
				this.logoLabel.setIcon(CustomIcons.logo);
			}
			thisLayout.setVerticalGroup(thisLayout
					.createSequentialGroup()
					.addContainerGap()
					.addComponent(this.tournamentTypeDropDown, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addComponent(this.tournamentNameTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addGroup(
							thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
									.addComponent(this.startDateTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
									.addComponent(this.separatorLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
									.addComponent(this.endDateTextField, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addComponent(this.organizerTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addComponent(this.tournamentLeadTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.refereeTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.statisticsWrapper, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(this.logoLabel, 0, 173, Short.MAX_VALUE).addContainerGap());
			thisLayout.setHorizontalGroup(thisLayout
					.createSequentialGroup()
					.addContainerGap()
					.addGroup(
							thisLayout
									.createParallelGroup()
									.addGroup(
											GroupLayout.Alignment.LEADING,
											thisLayout.createSequentialGroup().addComponent(this.startDateTextField, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
													.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
													.addComponent(this.separatorLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
													.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
													.addComponent(this.endDateTextField, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE).addGap(0, 93, Short.MAX_VALUE))
									.addComponent(this.tournamentTypeDropDown, GroupLayout.Alignment.LEADING, 0, 369, Short.MAX_VALUE)
									.addComponent(this.tournamentNameTextField, GroupLayout.Alignment.LEADING, 0, 369, Short.MAX_VALUE)
									.addComponent(this.organizerTextField, GroupLayout.Alignment.LEADING, 0, 369, Short.MAX_VALUE)
									.addComponent(this.tournamentLeadTextField, GroupLayout.Alignment.LEADING, 0, 369, Short.MAX_VALUE)
									.addComponent(this.refereeTextField, GroupLayout.Alignment.LEADING, 0, 369, Short.MAX_VALUE)
									.addComponent(this.statisticsWrapper, GroupLayout.Alignment.LEADING, 0, 369, Short.MAX_VALUE)
									.addComponent(this.logoLabel, GroupLayout.Alignment.LEADING, 0, 369, Short.MAX_VALUE)).addContainerGap());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public JComboBox getTournamentTypeDropDown() {
		return this.tournamentTypeDropDown;
	}

	public JTextField getRefereeTextField() {
		return this.refereeTextField;
	}

	public JTextField getTournamentLeadTextField() {
		return this.tournamentLeadTextField;
	}

	public JTextField getOrganizerTextField() {
		return this.organizerTextField;
	}

	public JTextField getEndDateTextField() {
		return this.endDateTextField;
	}

	public JLabel getSeparatorLabel() {
		return this.separatorLabel;
	}

	public JTextField getStartDateTextField() {
		return this.startDateTextField;
	}

	public JTextField getTournamentNameTextField() {
		return this.tournamentNameTextField;
	}

	@Override
	public IController getController() {
		return this.controller;
	}

}
